<template>
  <div>
    <el-form :model="sumForm">
      <el-form-item label="电子卡总余额"> {{ hzAmt }}元 </el-form-item>
      <el-form-item label="总会员个数"> {{ cardNum }}个 </el-form-item>
      <el-form-item label="电子卡每日动态变化值">
        <div>
          <el-table :data="dayReportList" stripe>
            <el-table-column label="日期" align="left" prop="createTime">
              <template slot-scope="scope">
                <span>{{
                  parseTime(scope.row.createTime, "{y}-{m}-{d}")
                }}</span>
              </template>
            </el-table-column>
            <el-table-column label="充值金额(元)" align="left" prop="czamt" />
            <el-table-column label="消费金额(元)" align="left" prop="xfamt" />
            <el-table-column label="新增电子会员" align="left" prop="cardnum" />
          </el-table>
          <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNo"
            :limit.sync="queryParams.pageSetting"
            @pagination="getList"
          />
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { listSum, selectCard } from "@/api/customer/card";
export default {
  name: "Dzk_Report",
  data() {
    return {
      // 总条数
      total: 0,
      hzAmt: 0,
      cardNum: 0,
      // 查询参数
      queryParams: {
        pageSetting: 10,
        pageNo: 1,
        levelId: this.levelId,
      },
      dayReportList: [],
      sumForm: {},
    };
  },

  created() {
    this.init();
  },
  methods: {
    init() {
      this.getHZlist();
      this.getList();
    },
    getList() {
      this.queryParams.levelId = this.levelId;
      selectCard(this.queryParams).then((response) => {
        this.dayReportList = response.rows;
        this.total = response.total;
      });
    },
    getHZlist() {
      listSum({
        levelId: this.levelId,
      }).then((response) => {
        if (response.hasOwnProperty("data")) {
          this.cardNum = response.data.num;
          this.hzAmt = response.data.amt;
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.flex {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 170px;
  flex-direction: column;
}
.flex-qy {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-qy-sx {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.panel-group {
  padding-left: 10px;
}

.flex-sr {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-direction: column;
}
.sr-font {
  font-size: 20px;
  color: #f4a645;
}
</style>
